package com.zjk.storage.core.aspect;

import com.zjk.storage.core.aspect.delete.DeleteAspectChain;
import com.zjk.storage.core.aspect.download.DownloadAspectChain;
import com.zjk.storage.core.aspect.download.DownloadThumbAspectChain;
import com.zjk.storage.core.aspect.exist.ExistAspectChain;
import com.zjk.storage.core.aspect.upload.UploadAspectChain;
import com.zjk.storage.core.entity.BaseFileInfo;
import com.zjk.storage.core.entity.UploadPretreatment;
import com.zjk.storage.core.provider.FileStorage;

import java.io.InputStream;
import java.util.function.Consumer;


public class FileStorageAspect {

    public BaseFileInfo uploadAround(BaseFileInfo fileInfo, UploadPretreatment pre, FileStorage fileStorage, UploadAspectChain chain) {
        return chain.next(fileInfo, pre, fileStorage);
    }

    public boolean existAround(BaseFileInfo fileInfo, FileStorage fileStorage, ExistAspectChain chain) {
        return chain.next(fileInfo, fileStorage);
    }

    public boolean deleteAround(BaseFileInfo fileInfo, FileStorage fileStorage, DeleteAspectChain chain) {
        return chain.next(fileInfo, fileStorage);
    }

    public void downloadAround(BaseFileInfo fileInfo, FileStorage fileStorage, Consumer<InputStream> consumer, DownloadAspectChain chain) {
        chain.next(fileInfo, fileStorage, consumer);
    }

    public void downloadThumbAround(BaseFileInfo fileInfo, FileStorage fileStorage, Consumer<InputStream> consumer, DownloadThumbAspectChain chain) {
        chain.next(fileInfo, fileStorage, consumer);
    }
}
